﻿<Window x:Class="Com.CodePlex.SPC3.SPbAM.View.CommandParameterDialog"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:localv="clr-namespace:Com.CodePlex.SPC3.SPbAM.View"
		Title="RunDialog" 
		Width="600"
		Height="400"
		WindowStartupLocation="CenterOwner">
	<Window.Resources>
		<DataTemplate x:Key="StringTemplate">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width=".40*" SharedSizeGroup="Column1"/>
					<ColumnDefinition SharedSizeGroup="Column2"/>
				</Grid.ColumnDefinitions>
				<TextBlock Grid.Column="0" Text="{Binding DisplayName}"/>
				<TextBox Grid.Column="1" Text="{Binding Value, Mode=TwoWay}" />
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="BoolTemplate">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition SharedSizeGroup="Column1"/>
					<ColumnDefinition SharedSizeGroup="Column2"/>
				</Grid.ColumnDefinitions>
				<TextBlock Grid.Column="0" Text="{Binding DisplayName}"/>
				<CheckBox Grid.Column="1" IsChecked="{Binding Path=Value, Mode=TwoWay}" />
			</Grid>
		</DataTemplate>
		<localv:CommandParameterTemplateSelector x:Key="ParameterTemplateSelector"
			StringTemplate="{StaticResource StringTemplate}" 
			BoolTemplate="{StaticResource BoolTemplate}" />
	</Window.Resources>
	<StackPanel>
		<ItemsControl Grid.IsSharedSizeScope="True" ItemsSource="{Binding Path=Parameters}" ItemTemplateSelector="{StaticResource ParameterTemplateSelector}">
		</ItemsControl>
		<StackPanel Orientation="Horizontal">
			<Button Click="RunButton_Click">Run</Button>
			<Button Width="100" Content="Cancel" IsCancel="True"/>
		</StackPanel>
	</StackPanel>
</Window>
